﻿#ifndef INFO_H
#define INFO_H

#include <list>
#include<iostream>

#pragma region 常量定义
//键
const std::string PLAYERINFO_KEY_Account="account";
const std::string PLAYERINFO_KEY_Passwd="passwd";
const std::string PLAYERINFO_KEY_Money="money";
const std::string PLAYERINFO_KEY_Pet="pet";
const std::string PLAYERINFO_KEY_Hungry="hungry";
const std::string PLAYERINFO_KEY_Play="play";
const std::string PLAYERINFO_KEY_Train="train";
const std::string PLAYERINFO_KEY_LastOfflineTime="lastOfflineTime";
const std::string PLAYERINFO_KEY_Health="health";
const std::string PLAYERINFO_KEY_Attack="attack";
const std::string PLAYERINFO_KEY_Defend="defend";
const std::string PLAYERINFO_KEY_Dodge="dodge";
const std::string PLAYERINFO_KEY_Crit="crit";
const std::string PLAYERINFO_KEY_Level="level";
const std::string PLAYERINFO_KEY_Stage="stage";
const std::string PLAYERINFOBAG_KEY_ChangeName="bag_changeName";
const std::string PLAYERINFOBAG_KEY_Hungry="bag_hungry";
const std::string PLAYERINFOBAG_KEY_Play="bag_play";
const std::string PLAYERINFOBAG_KEY_Train="bag_train";
const std::string PLAYERINFOBAG_KEY_Health="bag_health";
const std::string PLAYERINFOBAG_KEY_Attack="bag_attack";
const std::string PLAYERINFOBAG_KEY_Defend="bag_defend";
const std::string PLAYERINFOBAG_KEY_Dodge="bag_dodge";
const std::string PLAYERINFOBAG_KEY_Crit="bag_crit";
#pragma endregion


enum DO{
    get,
    set
};

class Bag
{
public:
    Bag()
    {
        changeName = 0;
        hungry = 0;
        play = 0;
        train = 0;
        health = 0;
        attack = 0;
        defend = 0;
        dodge = 0;
        crit = 0;
    }
    int changeName;
    int hungry;
    int play;
    int train;
    int health;
    int attack;
    int defend;
    int dodge;
    int crit;
};

class PlayerInfo
{
public:
    bool isLogined;
    PlayerInfo();
    PlayerInfo(std::string acc);
    //弃用
    int Update(DO do_what,std::string content);
    //设置与获取
    std::string GetInfo(std::string key);
    std::string SetInfo(std::string key,std::string content);
    //void Save();//保存到数据库
    std::string account;
    std::string passwd;
    float money;
    std::string pet;
    int hungry;
    int play;
    int train;
    float lastOfflineTime;
    int health;
    int attack;
    int defend;
    int dodge;
    int crit;
    int level;
    int stage;
    Bag bag;    
};

typedef PlayerInfo P;

#endif // INFO_H
